package com.homework2;

import java.util.HashSet;
import java.util.Iterator;

public class Test04 {
    public static void main(String[] args) {
        HashSet<Student> hashSet= new HashSet<>();
        hashSet.add(new Student("张三1",10,"男"));
        hashSet.add(new Student("张三2",10,"男"));
        hashSet.add(new Student("张三3",10,"男"));
        hashSet.add(new Student("张三4",10,"男"));
        hashSet.add(new Student("张三5",10,"男"));
        hashSet.add(new Student("张三6",10,"男"));
        hashSet.add(new Student("张三7",10,"男"));
        hashSet.add(new Student("张三8",10,"男"));
        hashSet.add(new Student("张三9",10,"男"));
        hashSet.add(new Student("张三10",10,"男"));
        Iterator<Student> iterator = hashSet.iterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.print(next+" ");
        }
        for (Student student : hashSet) {
            System.out.println(student+" ");
        }
    }
}
